package chp09;

import java.util.Scanner;

public class Test4 {

    static Scanner input = new Scanner(System.in);

    public static void loginMenu(){
        while (true) {
            System.out.println("\n欢迎使用学生管理系统");
            System.out.println("1.进入系统");
            System.out.println("2.退出");
            System.out.print("请选择:");
            int choose = input.nextInt();
            if (choose == 1) {
                System.out.print("请输入账号:");
                String username = input.next();
                System.out.print("请输入密码:");
                String password = input.next();
                if(username.equals("admin") && password.equals("1234")){
                    mainMenu();
                }else{
                    System.out.println("登录失败...");
                }

            } else {
                System.out.println("再见");
                break;
            }
        }
    }

    public static void mainMenu(){
        while (true) {
            System.out.println("\n1.新增学生");
            System.out.println("2.修改学生");
            System.out.println("3.查询学生");
            System.out.println("4.删除学生");
            System.out.println("0.返回上一级菜单");
            System.out.print("请选择:");
            String choose = input.next();
            if (choose.equals("1")) {
               addStudent();
            } else if (choose.equals("2")) {
               updateStudent();
            } else if (choose.equals("3")) {
               showAllStudent();
            } else if (choose.equals("4")) {
                deleteStudent();
            } else if (choose.equals("0")) {
                System.out.println("执行0.返回上一级菜单");
                break;
            } else {
                System.out.println("<<输入有误>>");
            }
        }
    }

    public static void addStudent(){
        System.out.println("执行1.新增学生");
        System.out.println("新增成功");
    }

    public static void updateStudent(){
        System.out.println("执行2.修改学生");
        System.out.println("修改成功");
    }

    public static void showAllStudent(){
        System.out.println("执行3.查询全部学生");
    }

    public static void deleteStudent(){
        System.out.println("执行4.删除学生");
        System.out.println("删除成功");
    }

    public static void main(String[] args) {
        loginMenu();
    }
}
